//
//  CYYCustomTextField.m
//  LetsParty
//
//  Created by YG on 15/9/23.
//  Copyright (c) 2015年 LetsPartyTeam. All rights reserved.
//

#import "CYYCustomTextField.h"

@implementation CYYCustomTextField

- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
    CGContextFillRect(context, CGRectMake(0, CGRectGetHeight(self.frame) - 0.5, CGRectGetWidth(self.frame), 0.5));
}

//重写placeholder的位置
- (CGRect)placeholderRectForBounds:(CGRect)bounds{
    CGRect changeRect = CGRectMake(bounds.origin.x + 40, bounds.origin.y, bounds.size.width, bounds.size.height);
    return changeRect;
}

////重写placeHolder的颜色
//- (void)drawPlaceholderInRect:(CGRect)rect{
//    [[UIColor whiteColor] setFill];
//    
//    [[self placeholder] drawInRect:rect withFont:[UIFont systemFontOfSize:15]];
//}

//重写文本输入的位置
- (CGRect)editingRectForBounds:(CGRect)bounds{
    CGRect changeRect = CGRectMake(bounds.origin.x + 40, bounds.origin.y, bounds.size.width, bounds.size.height);
    return changeRect;
}

//重写文本框的位置
- (CGRect)textRectForBounds:(CGRect)bounds{
    CGRect changeRect = CGRectMake(bounds.origin.x + 40, bounds.origin.y, bounds.size.width, bounds.size.height);
    return changeRect;
}

@end
